package cn.hp.kyc;

import cn.hp.kyc.business.AccountPassword;
import cn.hp.kyc.business.AccountPasswordImpl;
import cn.hp.kyc.money.User;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
 * @author yc
 * @year 2022年05月24日18:33
 */

public class Login {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String verify = "520 1314 6898 ";
        String verify1 = "1";
        GeneralUser generalUser = new GeneralUser();
        AdminUser adminUser = new AdminUser();
        AccountPassword accountPassword = new AccountPasswordImpl();
        List<User> list = new ArrayList();
        for (int i = 0; i <= 9; i++) {
            User user = new User();
            user.setAccount("520 1314 6898 " + i);
            user.setName("天涯浪子" + i);
            user.setPassword("123");
            user.setPhone("12345678910" + i);
            user.setBalance(9999.99);
            list.add(user);
        }
        int a = 0;
        while (true) {
            String[] str = accountPassword.enter();
            a++;
            for (int i = 0; i < 11; i++) {
                if (str[0]
                        .equals(verify + i) && str[1].equals("123")) {
                    System.out.println("欢迎 天涯浪子" + i + " 顾客登录!请注意您的安全");
                    generalUser.generalUser(true, i, list);
                    break;
                }
                if (str[0].equals(verify1 + i) && str[1].equals("123")) {
                    System.out.println("[管理员" + i + "] 管理员登录!");
                    adminUser.adminUser(true, list);
                    break;
                }
                if (i == 10) {
                    i = 0;
                    System.out.println("账号或密码错误重新输入");
                    break;
                }
            }
            if(a>6){
                System.out.println("错误次数过多是否继续");
                System.out.println("请输入Y/N");
                String a3 = sc.next();
                if (a3.equalsIgnoreCase("y")) {
                    a=0;
                }  else {
                    break;
                }
            }else {
                System.out.println("-----------------------");
            }
            if (true){
                System.out.println("11111111111");
            }
            if (true){
                System.out.println("11111111111");
            }

        }
    }
}